﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GBFinance.DAL;
using HiLand.Utility.Pattern;
using GBFinance.Entity;
using HiLand.Utility.Paging;

namespace GBFinance.BLL
{
    public class IncomeAssetBLL
    {
        private static IncomeAssetDAL dal = null;
        private static IncomeAssetDAL DAL
        {
            get
            {
                if (dal == null)
                {
                    dal = Singleton<IncomeAssetDAL>.Instance;
                }

                return dal;
            }
        }

        private static IncomeAssetDAL dalSave = null;
        private static IncomeAssetDAL DALSave
        {
            get
            {
                if (dalSave == null)
                {
                    dalSave = DAL;
                }

                return dalSave;
            }
        }

        public static bool Create(IncomeAssetEntity entity)
        {
            if (entity.ItemGuid == Guid.Empty)
            {
                entity.ItemGuid = Guid.NewGuid();
            }
            return DALSave.Create(entity);
        }

        public static bool Update(IncomeAssetEntity entity)
        {
            return DALSave.Update(entity);
        }

        public static bool Delete(IncomeAssetEntity entity)
        {
            return DALSave.Delete(entity);
        }

        public static bool Delete(Guid itemGuid)
        {
            return DALSave.Delete(itemGuid);
        }

        public static IncomeAssetEntity Get(Guid itemGuid)
        {
            return DALSave.Get(itemGuid);
        }

        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="onlyDisplayUsable"></param>
        /// <param name="whereClause"></param>
        /// <returns></returns>
        public static List<IncomeAssetEntity> GetList(string whereClause)
        {
            return DALSave.GetList(whereClause);
        }

        public static PagedEntityCollection<IncomeAssetEntity> GetPagedCollection(int startIndex, int pageSize, string whereClause, string orderClause)
        {
            return DALSave.GetPagedCollection(startIndex, pageSize, whereClause, orderClause);
        }
    }
}